function fig72

% number of initial points
np=10;

tmax=15;

%vid = VideoWriter('/Users/mark/Desktop/solution_curves','MPEG-4');
%open(vid)
%frames=2;

clf
co = [0 0 1;
    0 0.5 0;
    1 0 0;
    0 0.75 0.75;
    0.75 0 0.75;
    0.75 0.75 0;
    0.25 0.25 0.25];
set(groot,'defaultAxesColorOrder',co)
% get(gcf)
set(gcf,'Position', [25 1115 658 230])
subaxis(1,1,1,1,'MT',0.05,'MB',0.2,'MR',-0.02,'ML',0.06,'P',0.03)
hold on
box on
axis([-3.2 3.2 -4 4])
plot([-4 4],[0 0],'k','LineWidth',0.2)
plot([0 0],[-7 7],'k','LineWidth',0.2)
%axis equal
%axis square
set(gca,'FontSize',12)
xlabel('$y$-axis','Interpreter','latex','FontSize',14)
ylabel('$v$-axis','Interpreter','latex','FontSize',14)

say=['$u^{\prime}=v-\frac{1}{2}u, \,\,\, v^{\prime}=-\frac{1}{2}v+2u(1-u^2)$'];
%title(say,'FontSize',16,'FontWeight','bold','Interpreter','Latex')

say=['Holmes, 2023'];
%text(2,-7.6,say,'FontSize',10,'FontWeight','bold')

xdot=1.5; xdot2=xdot+0.1;
%plot(xdot,4.9,'.k','LineWidth',2,'MarkerSize',20)
say=['= Initial Point'];
%text(xdot2,5,say,'FontSize',12,'FontWeight','bold')

% R=3;
% %dtheta=pi/8;
% dtheta=8*pi/64;
% theta=linspace(dtheta,2*pi+dtheta,np+1);
% for ip=1:np
%     u0(ip)=R*cos(theta(ip));
%     v0(ip)=R*sin(theta(ip));
%     %plot(u0(ip),v0(ip),'.k','LineWidth',2,'MarkerSize',20)
% end

% np=8; R=3;
% dt=2*pi/9;  
% theta=8*pi/64+[-0.15*dt 1.2*dt 2*dt 3.5*dt 5*dt 6*dt 6.6*dt 7.5*dt];
np=4; R=3;
dt=2*pi/9;  
theta=8*pi/64+[-0.15*dt 1.4*dt 3.5*dt 5.5*dt];
for ip=1:np
    u0(ip)=R*cos(theta(ip));
    v0(ip)=R*sin(theta(ip));
    %plot(u0(ip),v0(ip),'.k','LineWidth',2,'MarkerSize',20)
end

theta=linspace(0,2*pi,200);
for ip=1:200
    u(ip)=R*cos(theta(ip));
    v(ip)=R*sin(theta(ip));
end
plot(u,v,'--k','LineWidth',0.3)
plot([-1 0 1],[0 0 0],'ok','LineWidth',1.5,'MarkerSize',8)

%F = getframe(gcf);
%writeVideo(vid,F);

for ip=1:np+1

    % hack to fix arrow on last curve problem
    if ip==np+1
        u0(np+1)=6;  v0(np+1)=0; tmax=0.1;
    end

    opts = odeset('RelTol',1e-12,'AbsTol',1e-12);
    [t,y] = ode45(@rhs,[0 tmax],[u0(ip) v0(ip)], opts);

    NT=length(t);

    if y(length(t),1)>0
        color='red';
    else
        color='blue';
    end

    plot(y(1,1),y(1,2),'.','Color',color,'LineWidth',2,'MarkerSize',15)
    %F = getframe(gcf);
    % for i=1:30
    %     writeVideo(vid,F);
    % end

    dd=30; ii=1; dN=round(NT/dd);
    for i=1:dd-1
        iii=min(ii+dN,NT);
        plot(y(ii:iii,1),y(ii:iii,2),'-','Color',color,'LineWidth',1.2)
        ii=iii;
        % F = getframe(gcf);
        % for i=1:3
        %     writeVideo(vid,F);
        % end
    end

    i=280; ii=i+1;  ar1=2; ar2=0.8;
    if y(length(t),1)>0
        arrowhead([y(i,1) y(ii,1)],[y(i,2) y(ii,2)],'r',[ar1 ar2],3);
    else
        arrowhead([y(i,1) y(ii,1)],[y(i,2) y(ii,2)],'b',[ar1 ar2],3);
    end

    % for i=1:30
    %     writeVideo(vid,F);
    % end

end
exportgraphics(gca,'/Users/mark/Desktop/fig62.pdf')

%  define RHS of equations
function dy=rhs(t,y)
dy=zeros(2,1);
beta=0.5;
dy(1)=y(2);
dy(2)=-2*beta*y(2)+y(1)-y(1)^3;



























